#pragma once
#include "vec3.h"
#include "vec2.h"
#include "GlobalDefine.h"
#include "Utility.h"
#include <string>

namespace mray{

	struct BaseTexture{
		virtual ~BaseTexture(){}
		virtual vec3 GetColor(const vec2& uv)const = 0;
	};

	struct ColorTexture : public BaseTexture{
		ColorTexture(const vec3& color):m_color(color){}
		virtual ~ColorTexture(){}

		virtual vec3 GetColor(const vec2& uv)const{return m_color;}
	private:
		vec3 m_color;
	};

	struct BitmapTexture : public BaseTexture{

		BitmapTexture(const std::string& file);
		~BitmapTexture(){ if(data) delete [] data; }

		vec3 GetColor(const vec2& uv)const;
	private:
		int w, h, n;
		unsigned char* data;
	};
}